#include "MCUUart.h"
#include "MCUPhaser.h"
#ifdef USE_UART

#define CMDVOL 6
s8 CmdCnt = 0;
Cmd CmdLine[CMDVOL];
Cmd cmd;

bool CmdPushBack(Cmd cmd)
{
	if (CmdCnt >= (CMDVOL-1))
	{
		CmdCnt = (CMDVOL-1);
		return false;
	}
	CmdLine[CmdCnt].cmd = cmd.cmd;
	CmdLine[CmdCnt].para = cmd.para;
	CmdCnt++;
	return true;
}

bool CmdPopFront(Cmd *cmd)
{
	if (CmdCnt < 1)
	{
		CmdCnt = 0;
		return false;
	}
	CmdCnt -= 1;
	cmd->cmd = CmdLine[CmdCnt].cmd;
	cmd->para = CmdLine[CmdCnt].para;
	return true;
}

char CmdSize()
{
	return CmdCnt;
}

bool RxTimeOutCtrl(u8 Sel)
{
	static u16 timeout = 250;
	switch (Sel)
	{
	case 0:
		if (timeout > 0)
		{
			timeout--;
		}
		break;
	case 1:
		return (bool)(!timeout);
	case 2:
		timeout = 250;
		break;
	default:
		break;
	}
	return (true);
}


#endif

